<%@page import="cn.sendto.model.UserInfoModel"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.service.UserInfoService"%>
<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" errorPage="../err.jsp"%>
<jsp:include page="../lock.jsp"></jsp:include>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改信息</title>
<style>
.txt20 {
	font-size: 20px;
}

.td {
	font-size: 18px;
	height: 50px;
	text-align: right;
}
.star{
	font-size:12px;
	color:red;
}
</style>
</head>

<body>
<div class="txt20">当前位置-->修改用户信息</div>
<%
	request.setCharacterEncoding("UTF-8");
	String username = request.getParameter("id");
	String userpass = "null";
	String name = "null";
	String usertel = "null";
	UserInfoService uis = new UserInfoService();
	List<UserInfoModel> list = uis.selUser(username);
	if (list.size() > 0) {
		userpass = list.get(0).getUserPass();
		name = list.get(0).getName();
		usertel = list.get(0).getUserTel();
	}

	//判断错误信息
	ArrayList<Integer> errlist = new ArrayList<Integer>();
	if (request.getAttribute("errinfo") != null) {
		errlist = (ArrayList<Integer>) request.getAttribute("errinfo");
	}
%>
	<div>
		<form action="domoduser.jsp" method="post">
			<table width="95%" cellspacing="1" cellpadding="0" align="center"
			style="background-color: azure">
			<tr>
				<td colspan="2" height="30px"></td>
			</tr>
				<tr>
					<td class="td">用户名：</td>
					<td><input type="text" name="username" value="<%=username%>"
						readonly="readonly"></td>
				</tr>
				<tr>
					<td class="td">密码：</td>
					<td><input type="password" name="userpass"
						value="<%=userpass%>"> <%
 	for (int i = 0; i < errlist.size(); i++) {
 		if (errlist.get(i) == 1) {
 			out.println("<span class=\"star\">*请输入密码。</span>");
 			break;
 		}
 	}
 %></td>
				</tr>
				<tr>
					<td class="td">姓名：</td>
					<td><input type="text" name="name" value="<%=name%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 2) {
									out.println("<span class=\"star\">*请输入姓名。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td class="td">电话：</td>
					<td><input type="text" name="usertel" value="<%=usertel%>">
						<%
							for (int i = 0; i < errlist.size(); i++) {
								if (errlist.get(i) == 3) {
									out.println("<span class=\"star\">*请输入电话。</span>");
									break;
								}
							}
						%></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="submit" value="提交" style="width: 100px; height: 25px"
						onclick="return confirm('是否确认修改')"></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>